Repository navigation
Bind saved C1 replans to the original capture digest - #9022
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, max)
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
C1 在保存一次 replan 后可用原捕获继续阅读,此时 Agent 需要确认后续评审及写回沿用同一份决策。旧保存路径进入分阶段 reader 时只有语义 hash,重编码后的等价 JSON 仍会被当成同一份捕获。候选也传递私有原件的字节 SHA-256,分阶段读会拒绝同语义的重编码和另一个展示缓存的摘要。本次复核覆盖已保存 replan 后的分阶段读取与原 Turn 结算,和 #9016 的暖轮投影及已安装 App 采用独立验收。
改动思路 / Approach
沿用原完整决策、原字节验证和 TypeScript 分阶段 owner。Python 保存的引用把原路径及已验证 SHA-256 一起传到 native 与 stateless 两种展示,展示缓存仍保留自己的摘要。分阶段 reader 使用原件字节摘要及语义 hash,原结算按既有 plan。人工恢复的非私有文件仍可用历史语义读取器,显式 off 使用原完整 reader。对同一 File 和 SQLite 输入分别运行三个入口,明确比较展示摘要、原件摘要及语义 hash。原写回和扣额通过实际命令读回。
具体改动 / Changes
精确 head e36280b7bbe4f8fd88acb7bf86434c01eb886d40,diff base 9af4caa72ec1fc319d48a92399d53827488dfa38,6 个文件 +53/-33。逐项复核 original-capture-identity、historical-recovery、single-original-settlement。验收约定
关键代码讲解
- context-project 先核对原文件字节、Goal、Agent 和 Turn,再为可私有读取的完整原件保留输入 digest。stateless 和 native 展示都从这一引用生成后续读取。源码
- native 导航及初读和 stateless 初读覆盖三条路线。两种后端的评审、探索和写回读均拒绝等价 JSON 改写和不同的展示摘要,并仍校验语义 hash。源码
- 人工恢复的非私有原件仍走历史语义 reader;显式 off 保留原完整读取。正确原件可恢复,读阶段没有重跑 guard 或增加扣额。源码
- File 与 SQLite 均实际执行阶段返回的原 writeback 及 quota 步骤,读回原 autonomous_replan 身份与单次扣额。原文档中的多种 hash 没有被视为同一个值。源码
对主干的风险 / Risks
完整 Python 文件 36 项通过,2 项在 File 和 SQLite 的同一 memory relocation 断言失败,基线同样失败。独立对照中 18 条有效阶段路线拒绝展示摘要与字节重编码。4 项 native reader、66 项 TypeScript、类型检查、Ruff 和预检 6 项直接及 18 项选中检查通过。
语义与 CI 对齐
核对原完整字节、语义来源及原结算读回,原准入与窗口事实没有引入新效果。已安装 App 和暖轮模型采用仍待独立验收。与当时最新 main 组合后,读取和单次结算共四项复验通过。
我的整体评价 / Verdict
当前精确头无阻断发现,批准保存 replan 后的分阶段读绑定。旧 scoped-memory 测试仍有两项可复现失败,保留其独立处理。暖轮及安装采用结论按原规则另行验证。
English verdict: APPROVE. Saved replan stages preserve the original byte and semantic digests. Both backends reject mismatches and settle the original effect once. Two unrelated baseline memory tests remain red.
Goal And Delivered Outcome
Restore the original capture binding for saved C1 replan reads on
main. The implementation in #8712 landed on the C1 integration branch. After the mainline cutover,quota context-projectcould resume a saved replan with the semantic source hash alone. Re-encoding the same JSON preserves that hash and should fail an exact-capture read.Native and stateless saved-capture presentation pass one original file reference to the existing TypeScript stage composer. Review, acceptance, explore and writeback carry the original path and byte digest for a private C1 capture. Supporting-material reads continue to use their own projection reference. Manually restored captures retain the historical semantic reader when they cannot serve as private capture files.
Related to #8712 and #8266. Target branch
main.Author Declaration
Written by an OpenAI Codex model agent.
Implemented Against
C1 contract and context migration and the original saved-capture recovery fix in #8712.
quota_native_context.pyandnativeReplanPresentation. The existing File and SQLite saved-replan test checks the path, SHA-256 and rejection of re-encoded JSON.replan-viewand typed settlement commands. The staged writeback exposes the original binding across both backends.Scope And Continuation
The saved-capture reader change can ship separately. A native session can recover through a full read and continue with a digest-bound stage. #9016 fixes the independent error that prevented the warm delta from reaching that stage. Installed App and matched single-session outcome and cost qualification belong to the broader C1 delivery.
Validation
Tested revision
e36280b7bbe4f8fd88acb7bf86434c01eb886d40on Node 24.21.0 and SQLite 3.53.4. Synthetic inputs and isolated File and SQLite stores.tests/control_plane/test_replan_progress_native_cli.py -k 'stateless_progressive or progressive_replan_stages'passed six tests. The two saved-capture tests failed on the prior implementation at the missing stage digest and pass here.d04e60d9ea7e8b768169a676106127d87ce00535, the File and SQLite cases both went from cold full read to warm delta, through required pages and staged review, acceptance and writeback. Each rejected a wrong stage digest and settled once.The native check uses an executable local fixture and a deterministic loopback model. It verifies tool delivery, backend state and receipt behavior. Installed App behavior and model outcome/cost are pending C1 qualification.